package modelo;
import org.hibernate.HibernateException;
import org.hibernate.Session;

import entities.FacturaEntity;
import entities.PlanProduccionEntity;
import hbt.AbstractHibernateManager;

public class PlanProduccionDao extends AbstractHibernateManager {

			
			public void save (PlanProduccionEntity planprod){
				Session s = null;
				try {
					s=getNewSession();
					s.beginTransaction();
					s.persist(planprod);
					s.flush();
					s.getTransaction().commit();
					System.out.println("[Plan Produccion PERSISTED ON TABLE Plan Produccion & ItemPlanProduccion]::OK");
				} catch (HibernateException e) {
					e.printStackTrace();
				} finally{
					closeSession(s);
				}
			}	
			
			
			public void guardar (PlanProduccionEntity planprod){
				Session s = null;
				try {
					s=getNewSession();
					s.beginTransaction();
					s.save(planprod);
					s.flush();
					s.getTransaction().commit();
					System.out.println("[Plan Produccion SAVED ON TABLE Plan Produccion & ItemPlanProduccion]::OK");
				} catch (HibernateException e) {
					e.printStackTrace();
				} finally{
					closeSession(s);
				}
			}
}
